package com.iwhalecloud.citybrain.flow.platform.manager.application.service;

import java.util.Map;

import com.iwhalecloud.citybrain.flow.platform.manager.common.ResponseResult;
import com.iwhalecloud.citybrain.flow.platform.manager.common.client.*;
import com.iwhalecloud.citybrain.flow.platform.manager.domain.model.ProcessHandleVo;
import com.iwhalecloud.citybrain.flow.platform.manager.domain.model.ProcessQueryVo;


/**
 * @author cheng.huaxing
 * @date 2019-01-24
 */
public interface FlowProcessService {

    /**
     * 获取监控流程列表
     */
    ResponseResult list(ProcessQueryVo processQueryVo);


    /**
     * 流程实例处理
     *
     * @param processHandleVo
     * @return
     */
    ResponseResult handleProcessInstance(ProcessHandleVo processHandleVo);

    /**
     * 获取实例流程图与基本信息
     *
     * @param processInstanceId
     * @return
     */
    ResponseResult getProcessInstanceDiagramAndInfo(String processInstanceId);

    /**
     * 获取流程实例当前任务列表
     *
     * @param processQueryVo
     * @return
     */
    ResponseResult getProcessInstanceCurrentTasks(ProcessQueryVo processQueryVo);

    /**
     * 获取流程实例处理日志
     *
     * @param processQueryVo
     * @return
     */
    ResponseResult getProcessInstanceHandleLogs(ProcessQueryVo processQueryVo);

    /**
     * 获取流程实例会签任务信息
     *
     * @param taskId
     * @param processInstanceId
     * @return
     */
    ResponseResult getProcessInstanceMutiTaskInfo(String taskId, String processInstanceId);

    /**
     * 启动流程
     *
     * @param processDefinitionKey 模型key
     * @param variables            启动变量，表单变量
     * @return 流程实例id
     */
    String startProcess(String processDefinitionKey, Map<String, Object> variables);

    /**
     * 生成流程图
     *
     * @param processInstanceId 实例id
     * @return 流程图信息
     */
    HttpProcessGraphResponseDto generateProcessDiagram(String processInstanceId);

    /**
     * 生成流程xml
     *
     * @param processInstanceId 实例id
     * @return 流程xml信息
     */
    HttpProcessXmlResponseDto generateProcessXml(String processInstanceId);

    /**
     * 使用外置表单启动一个流程
     * @param processDefinitionKey
     * @param formId
     * @return 流程实例id
     */

    String startProcessWithExternalForm(String processDefinitionKey,String formId);

    /**
     * 撤销流程
     * @param httpCancelProcessInstanceDto
     * @return 撤销成功与否
     */
    boolean cancelProcessInstance(HttpCancelProcessInstanceDto httpCancelProcessInstanceDto) throws Exception;

    /**
     * 暂停(挂起)或激活(解挂)流程实例
     * @param httpProcessHandleDto
     * @return
     */
    boolean handleProcessInstanceByAction(HttpProcessHandleDto httpProcessHandleDto) throws Exception;

    /**
     * 暂停(挂起)或激活(解挂)任务
     * @param httpProcessHandleDto
     * @return
     */
    boolean handleTaskByAction(HttpProcessHandleDto httpProcessHandleDto) throws Exception;

    /**
     * 在流程实例中动态新增节点
     *
     * @param httpDynamicInjectTaskDto
     * @return
     */
    ResponseResult dynamicInjectTask(HttpDynamicInjectTaskDto httpDynamicInjectTaskDto);

    /**
     * 将流程实例迁移至流程最新版本
     *
     * @param httpMigrateProcessModelDto
     * @return
     */
    ResponseResult migrateToNewVersion(HttpMigrateProcessModelDto httpMigrateProcessModelDto);

    /**
     * 重启被终止的流程
     * @param httpProcessHandleDto
     * @return
     */
    ResponseResult restartProcess(HttpProcessHandleDto httpProcessHandleDto);

    /**
     * 根据流程id修改审批节点审批人
     */
    String queryCurrentNodeByFlowId(HttpModifyApproverVO modifyApproverVO);
}
